package java19_5_9.com.huweilong.io;

import java.io.*;
import java.util.Scanner;

/**
 * @author 是阿秋啊
 * @date 2022/05/09 20:38
 **/
public class ReplaceTool {
    public static void main(String[] args) throws IOException {
        try(InputStream io = new FileInputStream("src.txt")) {
            try(Scanner sc = new Scanner(io,"utf-8")) {
                try(OutputStream os = new FileOutputStream("total.txt")) {
                    try(Writer writer = new OutputStreamWriter(os,"utf-8")) {
                        try(PrintWriter printWriter = new PrintWriter(writer)) {
                            while (sc.hasNext()) {
                                String line = sc.nextLine();
                                String replace = line.replace("你好","我hen好");
                                printWriter.println(replace);
                            }
                            printWriter.flush();
                        }
                    }
                }
            }
        }
    }
}
